import request from './../../utils/request'

// 登录接口
export const login = loginForm => request.post('login', loginForm)

// 获取用户列表数据接口
export const getUserList = params => request.get('users', { params })

// 修改用户状态接口
export const modifyUserState = (userId, state) => request.put(`users/${userId}/state/${state}`)

// 新增用户接口
export const addUser = user => request.post('users', user)

// 根据ID获取用户信息
export const getUserById = id => request.get(`users/${id}`)

// 修改用户信息
export const modifyUserInfo = user => request.put(`users/${user.id}`, user)

// 根据ID删除用户
export const deleteUserById = id => request.delete(`users/${id}`)

// 修改用户角色
export const modifyUserRole = (userId, rid) => request.put(`users/${userId}/role`, { rid })
